package com.lc202310;

import java.util.ArrayList;
import java.util.List;

/**
 * Description:
 *
 * @Create 2023/10/7 22:51
 * @Version 1.0
 */
public class Solution119 {
    public List<Integer> getRow(int rowIndex) {
        List<Integer> pre = new ArrayList<>();
        for (int i = 0; i < rowIndex + 1; i++) {
            List<Integer> cur = new ArrayList<>();
            for (int j = 0; j <= i; j++) {
                if (j == 0 || i == j) {
                    cur.add(1);
                } else {
                    cur.add(pre.get(j) + pre.get(j - 1));
                }
            }
            pre = cur;
        }
        return pre;
    }
}
